<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ page import="crm.model.Material" %>
<%@ page import="crm.control.MaterialControl"%>
<%@ page import="crm.control.DateControl"%>
<%@ page import="java.util.*"  %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>修改常备资料</title>
  </head>
  
  <body>
    		<%
				request.setCharacterEncoding("UTF-8");
				MaterialControl mc = new MaterialControl();
				 DateControl dc = new DateControl(); 
	             String time = dc.Date();  
				int id = Integer.parseInt(request.getParameter("id"));
				String material_name = request.getParameter("material_name");
			
				int sale_area_id = Integer.parseInt(request.getParameter("sale_area_id"));	
				String path = request.getParameter("path");	
				
				Material material = new Material();
				material.setMaterial_name(material_name);
				material.setUpload_time(time);
				material.setSale_area_id(sale_area_id);
				material.setPath(path);
				
				if (mc.updateMaterial(material, id)) {
		%>
	 <script language = "javascript">
if(window.confirm("更新成功！"))
window.top.location.href = "material_download.jsp";
else
window.top.location.href = "material_download.jsp";
</script>
<%} else { %>
<script language="javascript">
if(window.confirm("更新失败！"))
window.top.location.href = "material_download.jsp";
else
window.top.location.href = "material_download.jsp";
</script>
		<%
	  		}
		%>
  </body>
</html>
